package cn.lingyangwl.agile.pay.client.constants;

import cn.lingyangwl.framework.tool.core.exception.BizException;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author shenguangyang
 */
@Getter
@AllArgsConstructor
public enum PayStatusEnum {
    NOT_PAY("1"),
    CANCEL_PAY("2"),
    PAY("3"),
    CLOSE_PAY("4"),
    ;
    private final String code;

    public static PayStatusEnum of(String code) {
        return Arrays.stream(values()).filter(e -> e.getCode().equalsIgnoreCase(code))
                .findFirst().orElseThrow(() -> new BizException("支付状态不存在"));
    }
}
